package day29;

import java.io.Serializable;
import java.text.DecimalFormat;

public class MaterCode implements Serializable  {

	private String code;    // 품목 코드 
	private String codeName; // 품목명
	private int price; // 단가
	private String spec;// 제품 사양
	private String customer;// 거래처
	private int importEa;// 입고수량
	private int exportEa;// 출고수량
	
	
	
	public MaterCode(String code, String codeName, int price, String spec,
			String customer, int importEa, int exportEa) {
		super();
		this.code = code;
		this.codeName = codeName;
		this.price = price;
		this.spec = spec;
		this.customer = customer;
		this.importEa = importEa;
		this.exportEa = exportEa;
	}
	
	

	public boolean compare(String findStr){
		boolean b= false;
		if(this.code.contains(findStr)
				||this.codeName.contains(findStr)
				||this.spec.contains(findStr)
				||this.customer.contains(findStr) ){
			b=true;
			}
		return b;
		}
	
	

	@Override 
	public String toString() {
		String result =null;
		DecimalFormat df = new DecimalFormat("#,###,###.##");
		String pStr = df.format(price);
		String imStr = df.format(importEa);
		String exStr = df.format(exportEa);
		result = String.format("%-10s %-10s %10d %10d %10d %-20s %-20s",
				code,
				codeName,
				price, //pStr 로도사용
				importEa, //imStr로도사용
				exportEa,//exStr로도사용
				spec,
				customer);
			return result;
	}
	
	
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getCodeName() {
		return codeName;
	}
	public void setCodeName(String codeName) {
		this.codeName = codeName;
	}
	public int getPrice() {
		return price;
	}
	public void setPrice(int price) {
		this.price = price;
	}
	public String getSpec() {
		return spec;
	}
	public void setSpec(String spec) {
		this.spec = spec;
	}
	public String getCustomer() {
		return customer;
	}
	public void setCustomer(String customer) {
		this.customer = customer;
	}
	public int getImportEa() {
		return importEa;
	}
	public void setImportEa(int importEa) {
		this.importEa = importEa;
	}
	public int getExportEa() {
		return exportEa;
	}
	public void setExportEa(int exportEa) {
		this.exportEa = exportEa;
	}
	
	
}
